﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GA;

namespace IndicadorDeMusicas
{
    public partial class Playlist : Form
    {
        Form1 call = null;
        List<Musica> playlist = null;
        public Playlist(List<Musica> playlist, Form1 caller)
        {
            InitializeComponent();
            listBox1.DataSource = playlist;
            listBox1.DisplayMember = "Display";
            call = caller;
            this.playlist = playlist;
            CalcularFitness();
        }

        private void btnGostei_Click(object sender, EventArgs e)
        {
            call.Threshold = call.Threshold - 5;
            this.Close();
        }

        private void btnNaoGostei_Click(object sender, EventArgs e)
        {
            call.Threshold = call.Threshold + 5;
            this.Close();
        }

        public void CalcularFitness()
        {
            int fitness = 0;
            foreach (Musica musica in playlist)
            {
                fitness += musica.Fitness;
            }
            lblFitness.Text = fitness.ToString();
        }
    }
}
